<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="mini" label-width="68px">
      <el-row :gutter="20">
        <el-col :span="4">
          <el-form-item label="项目区域" prop="projectRegion">
            <el-select v-model="queryParams.projectRegion" placeholder="请选择" clearable
              @keyup.enter.native="handleQuery">
              <el-option v-for="dict in dict.type.cld_project_region" :key="dict.value" :label="dict.label"
                :value="parseInt(dict.value)"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="项目名称">
            <el-input v-model="queryParams.projectName" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
          </el-form-item>
        </el-col>
        <el-col :span="4" label-width="10px">
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-table v-loading="loading" :data="list" border>
      <el-table-column label="项目区域" align="center" prop="projectRegion">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.cld_project_region" :value="scope.row.projectRegion" />
        </template>
      </el-table-column>
      <el-table-column label="项目名称" align="center" prop="projectName" />
      <el-table-column label="累计维修次数" align="center" prop="reportNumber" />
      <el-table-column label="累计维修金额" align="center">
        <template slot-scope="scope">
          {{ toMoney(scope.row.reportOtherMoney + scope.row.reportMoney) }}
        </template>
      </el-table-column>
      <el-table-column label="累计折旧期数" align="center" prop="depreciationNumber">
        <template slot-scope="scope">
          {{ scope.row.depreciationNumber ? scope.row.depreciationNumber : 0 }}
        </template>
      </el-table-column>
      <el-table-column label="累计折旧金额" align="center" prop="depreciationMoney">
        <template slot-scope="scope">
          {{ toMoney(scope.row.depreciationMoney) }}
        </template>
      </el-table-column>
      <el-table-column label="累计增值期数" align="center" prop="addedNumber">
        <template slot-scope="scope">
          {{ scope.row.addedNumber ? scope.row.addedNumber : 0 }}
        </template>
      </el-table-column>
      <el-table-column label="累计增值金额" align="center" prop="addedMoney">
        <template slot-scope="scope">
          {{ toMoney(scope.row.addedMoney) }}
        </template>
      </el-table-column>
    </el-table>


  </div>
</template>

<script>
import { selectAssetsDetailsGroupProject } from '@/api/cld/assets'
export default {
  name: "assetsDetailsGroupProject",
  props: {
    assetsIdCard: {
      type: String
    }
  },
  dicts: ['cld_project_region'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 列表数据
      list: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        assetsIdCard: this.assetsIdCard,
        projectRegion: null,
        projectName: null
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      selectAssetsDetailsGroupProject(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
        this.list = response.data;
        this.loading = false;
      })
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
        assetsIdCard: this.assetsIdCard,
        projectRegion: null,
        projectName: null
      }
      this.resetForm("queryForm");
      this.handleQuery();
    },
  }
};
</script>
<style scoped>
.el-select {
  width: 100%;
}
</style>
